﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

namespace _2017._01._24TestWork2
{
    class TextInput
    {
        private string pathToFile = @"C:\My files\TextInput.txt";

        public void WriteToFile(string text)
        {
            File.Delete(pathToFile);
            File.AppendAllText(pathToFile, text);
        }

        public void WordCalculator()
        {
            string textFromFile = File.ReadAllText(pathToFile);
            string[] words = textFromFile.Split(' ');
            Console.WriteLine("Количество слов в тексте: {0}", words.Count());
        }
    }
}
